<template>
    <button @click="flag=true">open</button>
    <teleport to="body">
    
   
    <div class="container">

    <div v-if="flag">
      hello geyao
    </div>
  
    <div>
      <button @click="flag=false">close</button>
    </div>

  </div>
</teleport>
</template>
<script setup>
import { ref } from 'vue'
let flag = ref(true)

</script>
<style scoped>
.container {
  width: 200px;
  height: 100px;
  background-color: #cccccc;
  position: absolute;
  left:50%;
  top:50%;
  transform: translate(-50%,-50%);
}

</style>